package com.woniu;

import cn.dev33.satoken.SaManager;
import com.woniu.service.ChatService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestClient;

@SpringBootApplication
@MapperScan("com.woniu.dao")
public class BusinessSchoolApplication {

    public static void main(String[] args) {
        SpringApplication.run(BusinessSchoolApplication.class, args);
        System.out.println("启动成功，Sa-Token 配置如下：" + SaManager.getConfig());
    }

    /**
     * 注册自己的Service包装类
     *
     */
    @Bean
    public ChatService chatService(ChatClient.Builder chatClientBuilder, ToolCallbackProvider tools) {
        return new ChatService(chatClientBuilder, tools);
    }

    @Bean
    public RestClient.Builder restClientBuilder() {
        return RestClient.builder();
    }

}
